<?php
class AbiturientsController extends AppController {

	var $name = 'Abiturients';
	var $helpers = array('Html', 'Form');

/*
 * контроллер для вывода изображения из таблицы в html страницу
 */	
	function showimage($id) {
		Configure::write('debug', 0);
		$this->Abiturient->recursive=-1;
        $photofile = $this->Abiturient->find('all', array('conditions' => array('Abiturient.id' => $id), 'fields' => array('Abiturient.photo')));
        if (!isset($photofile)){
        	$photofile = 'НЕТ ИЗОБРАЖЕНИЯ';
        }
        $this->set('photofile', $photofile);
        $this->render('/','showimagefile','showimage');
	}
	

/******************************************************************************************
 * 
 * 				ИНТЕРФЕЙС SIMPLEMANAGER A 
 * 
 *****************************************************************************************/	
/*
 * контроллер для вывода списка абитуриентов для простых менеджеров
 */
	function index() {
		$this->Abiturient->recursive = 0;
		$this->Abiturient->Behaviors->attach('Containable');
		$this->paginate['conditions'] = $this->Abiturient->getSimpleConditions();
		$abiturients = $this->paginate('Abiturient');
		$this->set('abiturients', $abiturients);	
	}
		
	function prepare ($id = null){
		if (!$id && empty($this->data)) {
			$this->Session->setFlash(__('Invalid Abiturient', true));
			$this->redirect(array('action' => 'index'));
		}
		if (!empty($this->data)) {
			//debug($this->data);
			
			if ($this->Abiturient->save($this->data)) {
				$this->Session->setFlash(__('The Abiturient has been saved', true));
				$this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The Abiturient could not be saved. Please, try again.', true));
			}		
		}	
		if (empty($this->data)) {
			$this->data = $this->Abiturient->read(null, $id);
			
			$genders = $this->Abiturient->Gender->find('list');
			$citizenships = $this->Abiturient->Citizenship->find('list');
			$regions = $this->Abiturient->Region->find('list');
			$schoolflanguages = $this->Abiturient->Schoolflanguage->find('list');
			$educationdoctypes = $this->Abiturient->Educationdoctype->find('list');
			
			// для оформления родственников
			$relativescount = $this->Abiturient->Relative->find('count', array('conditions' => array('Relative.abiturient_id' => $id)));
			if ($relativescount > 0) {
				$relatives = $this->Abiturient->Relative->find('all', array('conditions' => array('Relative.abiturient_id' => $id), 'fields' => array('Relative.id','Relative.fio', 'Relative.relativestype_id', 'Relative.abiturient_id')));
				$relativestypes = $this->Abiturient->Relative->Relativestype->find('list');
			}

			// для формирования результатов (оценок)
			$subjects = $this->Abiturient->Result->Subject->find('list');
			$resulttypes = $this->Abiturient->Result->Resulttype->find('list');
				$resultscount = $this->Abiturient->Result->find('count', array('conditions' => array('Result.abiturient_id' => $id)));
			if ($resultscount > 0){
				$this->Abiturient->Result->recursive = -1;
				$results = $this->Abiturient->Result->find('all', array('conditions' => array('Result.abiturient_id' => $id)));
			}
			
			// для формирования выбранных специальностей
			$selectedprofessionscount = $this->Abiturient->Selectedprofession->find('count', array('conditions' => array('Selectedprofession.abiturient_id' => $id)));
			if ($selectedprofessionscount > 0){
				$facultets = $this->Abiturient->Selectedprofession->Profession->Facultet->find('list');
				$selectedprofessions = $this->Abiturient->Selectedprofession->find('all', array('conditions' => array('Selectedprofession.abiturient_id' => $id), 'order' => array('Selectedprofession.id')));
				//debug ($selectedprofessions);
				$subjectsprofessions = $this->Abiturient->Selectedprofession->Profession->SubjectsProfession->find('all');
				//debug ($Subjectsprofessions);
				$minimalresults = $this->Abiturient->Selectedprofession->Profession->Minimalresult->find('all');
			} 						
			
			// для формирования договоров (контрактов) на внебюджетное обучение
		//	$contractscount = $this->Abiturient->Contract->find('count', array('conditions' => array('Contract.abiturient_id' => $id)));
		//	if ($contractscount){
		//		$contracts = $this->Abiturient->Contract->find('all', array('conditions' => array('Contract.abiturient_id' => $id)));
		//	}			
			// для оформления льгот
			$privileges = $this->Abiturient->Privilege->find('list');
			$privilegescount = $this->Abiturient->AbiturientsPrivilege->find('count', array('conditions' => array('AbiturientsPrivilege.abiturient_id' => $id)));
			if ($privilegescount){
				$abiturientsprivileges = $this->Abiturient->AbiturientsPrivilege->find('all', array('conditions' => array('AbiturientsPrivilege.abiturient_id' => $id))); 
			}
		//	$privilege_id = $this->data['Abiturient']['privilege_id'];
		//	$this->set('privilege_id', $privilege_id);
			// для участия в целевом набое
			$targetingintakescount = $this->Abiturient->Targetingintake->find('count', array('conditions' => array('Targetingintake.abiturient_id' => $id)));
			if ($targetingintakescount){
				$targetingintakes = $this->Abiturient->Targetingintake->find('all', array('conditions' => array('Targetingintake.abiturient_id' => $id)));
			}
			// для формирования преимущества (приоритета)
			$prioritetscount = $this->Abiturient->AbiturientsPrioritet->find('count', array('conditions' => array('AbiturientsPrioritet.abiturient_id' => $id)));
			if ($prioritetscount){
				$prioritets = $this->Abiturient->Prioritet->find('list');
				$abiturientsprioritets = $this->Abiturient->AbiturientsPrioritet->find('all', array('conditions' => array('AbiturientsPrioritet.abiturient_id' => $id)));
			}
			$this->set(compact('genders', 'citizenships', 'regions',
			'schoolflanguages', 'educationdoctypes',
			'relativescount','relatives', 'relativestypes',
			'selectedprofessionscount','selectedprofessions', 'facultets',
			'minimalresults',
			'subjectsprofessions', 
			'contractscount', 'contracts',
			'resultscount', 'results', 'resulttypes', 'subjects',
			'privilegescount', 'privileges', 'abiturientsprivileges',
			'targetingintakescount', 'targetingintakes',
			'prioritetscount', 'prioritets', 'abiturientsprioritets'
			));
		}	// end if (empty($this->data))	
	} // end prepare
/*
 * контроллер для вывода поискового запроса simplemanager а 
 */	
	function simplesearch() {
		// фамилия
		$lastname = $this->data['lastname'];
		// серия паспорта
		$passport_ser = $this->data['passport_ser'];
		// номер паспорта
		$passport_num = $this->data['passport_num'];
		// номер личного дела (id абитуриента)
		$abiturient_id = $this->data['abiturient_id'];
		// создаем массив поисковых ключей
		$search_conditions = array();
		if ($lastname){
			array_push($search_conditions, array('Abiturient.lastname LIKE ' => $lastname.'%'));
		}
		if ($passport_ser) {
			array_push($search_conditions, array('Abiturient.passport_ser LIKE ' => $passport_ser.'%'));
		}
			if ($passport_num) {
			array_push($search_conditions, array('Abiturient.passport_num LIKE ' => $passport_num.'%'));
		}		
			if ($abiturient_id) {
			array_push($search_conditions, array('Abiturient.id LIKE ' => $abiturient_id.'%'));
		}		
		//debug ($search_conditions);
		$abiturients = $this->Abiturient->find('all', array('conditions' => $search_conditions, 'recursive' => 0, 
															'fields' => array('Abiturient.id', 
																				'Abiturient.lastname', 
																				'Abiturient.firstname', 
																				'Abiturient.surname', 
																				'Abiturient.passport_ser', 
																				'Abiturient.passport_num', 
																				'Abiturient.prepared', 
																				'Abiturient.approved', 
																				'Abiturient.enrolled', 
																				'Abiturient.canceled')));
		$this->set(compact('abiturients'));
	}
/******************************************************************************************
 * 
 * 				ИНТЕРФЕЙС MANAGER A 
 * 
 *****************************************************************************************/	
/*
 * вывод списка абиутриентов оформенных простыми менеджерами
 */
	function prepared () {
		$this->Abiturient->recursive = 0;
		$this->Abiturient->Behaviors->attach('Containable');
		$this->paginate['conditions'] = $this->Abiturient->getPreparedConditions();
		$abiturients = $this->paginate('Abiturient');
		$this->set('abiturients', $abiturients);		
	}
/*
 * поиск для менеджера
 */	
	function preparedsearch() {
		// фамилия
		$lastname = $this->data['lastname'];
		// серия паспорта
		$passport_ser = $this->data['passport_ser'];
		// номер паспорта
		$passport_num = $this->data['passport_num'];
		// номер личного дела (id абитуриента)
		$abiturient_id = $this->data['abiturient_id'];
		// создаем массив поисковых ключей
		$search_conditions = array();
		if ($lastname){
			array_push($search_conditions, array('Abiturient.lastname LIKE ' => $lastname.'%'));
		}
		if ($passport_ser) {
			array_push($search_conditions, array('Abiturient.passport_ser LIKE ' => $passport_ser.'%'));
		}
			if ($passport_num) {
			array_push($search_conditions, array('Abiturient.passport_num LIKE ' => $passport_num.'%'));
		}		
			if ($abiturient_id) {
			array_push($search_conditions, array('Abiturient.id LIKE ' => $abiturient_id.'%'));
		}		
		//debug ($search_conditions);
		$abiturients = $this->Abiturient->find('all', array('conditions' => $search_conditions, 'recursive' => 0, 
															'fields' => array('Abiturient.id', 
																				'Abiturient.lastname', 
																				'Abiturient.firstname', 
																				'Abiturient.surname', 
																				'Abiturient.passport_ser', 
																				'Abiturient.passport_num', 
																				'Abiturient.prepared', 
																				'Abiturient.approved', 
																				'Abiturient.enrolled', 
																				'Abiturient.canceled')));
		$this->set(compact('abiturients'));		
	}
/*
 * добавление в рейинг абитуриента менеджером
 */	
	function approve ($id = null){
		if (!$id && empty($this->data)) {
			$this->Session->setFlash(__('Invalid Abiturient', true));
			$this->redirect(array('action' => 'prepared'));
		}
		if (!empty($this->data)) {
			//debug($this->data);
			
			if ($this->Abiturient->save($this->data)) {
				$this->Session->setFlash(__('The Abiturient has been saved', true));
				$this->redirect(array('action' => 'prepared'));
			} else {
				$this->Session->setFlash(__('The Abiturient could not be saved. Please, try again.', true));
			}		
		}	
		if (empty($this->data)) {
			$this->data = $this->Abiturient->read(null, $id);
			
			$genders = $this->Abiturient->Gender->find('list');
			$citizenships = $this->Abiturient->Citizenship->find('list');
			$regions = $this->Abiturient->Region->find('list');
			$schoolflanguages = $this->Abiturient->Schoolflanguage->find('list');
			$educationdoctypes = $this->Abiturient->Educationdoctype->find('list');
			
			// для оформления родственников
			$relativescount = $this->Abiturient->Relative->find('count', array('conditions' => array('Relative.abiturient_id' => $id)));
			if ($relativescount > 0) {
				$relatives = $this->Abiturient->Relative->find('all', array('conditions' => array('Relative.abiturient_id' => $id), 'fields' => array('Relative.id','Relative.fio', 'Relative.relativestype_id', 'Relative.abiturient_id')));
				$relativestypes = $this->Abiturient->Relative->Relativestype->find('list');
			}

			// для формирования результатов (оценок)
			$subjects = $this->Abiturient->Result->Subject->find('list');
			$resulttypes = $this->Abiturient->Result->Resulttype->find('list');
				$resultscount = $this->Abiturient->Result->find('count', array('conditions' => array('Result.abiturient_id' => $id)));
			if ($resultscount > 0){
				$this->Abiturient->Result->recursive = -1;
				$results = $this->Abiturient->Result->find('all', array('conditions' => array('Result.abiturient_id' => $id)));
			}
			
			// для формирования выбранных специальностей
			$selectedprofessionscount = $this->Abiturient->Selectedprofession->find('count', array('conditions' => array('Selectedprofession.abiturient_id' => $id)));
			if ($selectedprofessionscount > 0){
				$facultets = $this->Abiturient->Selectedprofession->Profession->Facultet->find('list');
				$selectedprofessions = $this->Abiturient->Selectedprofession->find('all', array('conditions' => array('Selectedprofession.abiturient_id' => $id), 'order' => array('Selectedprofession.id')));
				//debug ($selectedprofessions);
				$subjectsprofessions = $this->Abiturient->Selectedprofession->Profession->SubjectsProfession->find('all');
				//debug ($Subjectsprofessions);
				$minimalresults = $this->Abiturient->Selectedprofession->Profession->Minimalresult->find('all');
			} 						
			
			// для формирования договоров (контрактов) на внебюджетное обучение
		//	$contractscount = $this->Abiturient->Contract->find('count', array('conditions' => array('Contract.abiturient_id' => $id)));
		//	if ($contractscount){
		//		$contracts = $this->Abiturient->Contract->find('all', array('conditions' => array('Contract.abiturient_id' => $id)));
		//	}			
			// для оформления льгот
			$privileges = $this->Abiturient->Privilege->find('list');
			$privilegescount = $this->Abiturient->AbiturientsPrivilege->find('count', array('conditions' => array('AbiturientsPrivilege.abiturient_id' => $id)));
			if ($privilegescount){
				$abiturientsprivileges = $this->Abiturient->AbiturientsPrivilege->find('all', array('conditions' => array('AbiturientsPrivilege.abiturient_id' => $id))); 
			}
		//	$privilege_id = $this->data['Abiturient']['privilege_id'];
		//	$this->set('privilege_id', $privilege_id);
			// для участия в целевом набое
			$targetingintakescount = $this->Abiturient->Targetingintake->find('count', array('conditions' => array('Targetingintake.abiturient_id' => $id)));
			if ($targetingintakescount){
				$targetingintakes = $this->Abiturient->Targetingintake->find('all', array('conditions' => array('Targetingintake.abiturient_id' => $id)));
			}
			// для формирования преимущества (приоритета)
			$prioritetscount = $this->Abiturient->AbiturientsPrioritet->find('count', array('conditions' => array('AbiturientsPrioritet.abiturient_id' => $id)));
			if ($prioritetscount){
				$prioritets = $this->Abiturient->Prioritet->find('list');
				$abiturientsprioritets = $this->Abiturient->AbiturientsPrioritet->find('all', array('conditions' => array('AbiturientsPrioritet.abiturient_id' => $id)));
			}
			$this->set(compact('genders', 'citizenships', 'regions',
			'schoolflanguages', 'educationdoctypes',
			'relativescount','relatives', 'relativestypes',
			'selectedprofessionscount','selectedprofessions', 'facultets',
			'minimalresults',
			'subjectsprofessions', 
			'contractscount', 'contracts',
			'resultscount', 'results', 'resulttypes', 'subjects',
			'privilegescount', 'privileges', 'abiturientsprivileges',
			'targetingintakescount', 'targetingintakes',
			'prioritetscount', 'prioritets', 'abiturientsprioritets'
			));
		}	// end if (empty($this->data))	
	} // end approve

/******************************************************************************************
 * 
 * 				ИНТЕРФЕЙС TOPMANAGER а
 * 
 *****************************************************************************************/	
/*
 * вывод списка абитуриентов участвующих в рейтинге для topmanager a
 */		
	function approved () {
		$this->Abiturient->recursive = 0;
		$this->Abiturient->Behaviors->attach('Containable');
		$this->paginate['conditions'] = $this->Abiturient->getApprovedConditions();
		$abiturients = $this->paginate('Abiturient');
		$this->set('abiturients', $abiturients);		
	}
/*
 * поиск для топменеджера
 */	
	function approvedsearch() {
		// фамилия
		$lastname = $this->data['lastname'];
		// серия паспорта
		$passport_ser = $this->data['passport_ser'];
		// номер паспорта
		$passport_num = $this->data['passport_num'];
		// номер личного дела (id абитуриента)
		$abiturient_id = $this->data['abiturient_id'];
		// создаем массив поисковых ключей
		$search_conditions = array();
		if ($lastname){
			array_push($search_conditions, array('Abiturient.lastname LIKE ' => $lastname.'%'));
		}
		if ($passport_ser) {
			array_push($search_conditions, array('Abiturient.passport_ser LIKE ' => $passport_ser.'%'));
		}
			if ($passport_num) {
			array_push($search_conditions, array('Abiturient.passport_num LIKE ' => $passport_num.'%'));
		}		
			if ($abiturient_id) {
			array_push($search_conditions, array('Abiturient.id LIKE ' => $abiturient_id.'%'));
		}		
		//debug ($search_conditions);
		$abiturients = $this->Abiturient->find('all', array('conditions' => $search_conditions, 'recursive' => 0, 
															'fields' => array('Abiturient.id', 
																				'Abiturient.lastname', 
																				'Abiturient.firstname', 
																				'Abiturient.surname', 
																				'Abiturient.passport_ser', 
																				'Abiturient.passport_num', 
																				'Abiturient.prepared', 
																				'Abiturient.approved', 
																				'Abiturient.enrolled', 
																				'Abiturient.canceled')));
		$this->set(compact('abiturients'));				
	}
/*
 * работа с абитуриентом участвующим в рейтинге изненение данных
 */
	function approvedchange($id = null) {
		if (!$id && empty($this->data)) {
			$this->Session->setFlash(__('Invalid Abiturient', true));
			$this->redirect(array('action' => 'prepared'));
		}
		if (!empty($this->data)) {
			//debug($this->data);
			
			if ($this->Abiturient->save($this->data)) {
				$this->Session->setFlash(__('The Abiturient has been saved', true));
				$this->redirect(array('action' => 'approved'));
			} else {
				$this->Session->setFlash(__('The Abiturient could not be saved. Please, try again.', true));
			}		
		}	
		if (empty($this->data)) {
			$this->data = $this->Abiturient->read(null, $id);
			
			$genders = $this->Abiturient->Gender->find('list');
			$citizenships = $this->Abiturient->Citizenship->find('list');
			$regions = $this->Abiturient->Region->find('list');
			$schoolflanguages = $this->Abiturient->Schoolflanguage->find('list');
			$educationdoctypes = $this->Abiturient->Educationdoctype->find('list');
			
			// для оформления родственников
			$relativescount = $this->Abiturient->Relative->find('count', array('conditions' => array('Relative.abiturient_id' => $id)));
			if ($relativescount > 0) {
				$relatives = $this->Abiturient->Relative->find('all', array('conditions' => array('Relative.abiturient_id' => $id), 'fields' => array('Relative.id','Relative.fio', 'Relative.relativestype_id', 'Relative.abiturient_id')));
				$relativestypes = $this->Abiturient->Relative->Relativestype->find('list');
			}

			// для формирования результатов (оценок)
			$subjects = $this->Abiturient->Result->Subject->find('list');
			$resulttypes = $this->Abiturient->Result->Resulttype->find('list');
				$resultscount = $this->Abiturient->Result->find('count', array('conditions' => array('Result.abiturient_id' => $id)));
			if ($resultscount > 0){
				$this->Abiturient->Result->recursive = -1;
				$results = $this->Abiturient->Result->find('all', array('conditions' => array('Result.abiturient_id' => $id)));
			}
			
			// для формирования выбранных специальностей
			$selectedprofessionscount = $this->Abiturient->Selectedprofession->find('count', array('conditions' => array('Selectedprofession.abiturient_id' => $id)));
			if ($selectedprofessionscount > 0){
				$facultets = $this->Abiturient->Selectedprofession->Profession->Facultet->find('list');
				$selectedprofessions = $this->Abiturient->Selectedprofession->find('all', array('conditions' => array('Selectedprofession.abiturient_id' => $id), 'order' => array('Selectedprofession.id')));
				//debug ($selectedprofessions);
				$subjectsprofessions = $this->Abiturient->Selectedprofession->Profession->SubjectsProfession->find('all');
				//debug ($Subjectsprofessions);
				$minimalresults = $this->Abiturient->Selectedprofession->Profession->Minimalresult->find('all');
			} 						
			
			// для формирования договоров (контрактов) на внебюджетное обучение
		//	$contractscount = $this->Abiturient->Contract->find('count', array('conditions' => array('Contract.abiturient_id' => $id)));
		//	if ($contractscount){
		//		$contracts = $this->Abiturient->Contract->find('all', array('conditions' => array('Contract.abiturient_id' => $id)));
		//	}			
			// для оформления льгот
			$privileges = $this->Abiturient->Privilege->find('list');
			$privilegescount = $this->Abiturient->AbiturientsPrivilege->find('count', array('conditions' => array('AbiturientsPrivilege.abiturient_id' => $id)));
			if ($privilegescount){
				$abiturientsprivileges = $this->Abiturient->AbiturientsPrivilege->find('all', array('conditions' => array('AbiturientsPrivilege.abiturient_id' => $id))); 
			}
		//	$privilege_id = $this->data['Abiturient']['privilege_id'];
		//	$this->set('privilege_id', $privilege_id);
			// для участия в целевом набое
			$targetingintakescount = $this->Abiturient->Targetingintake->find('count', array('conditions' => array('Targetingintake.abiturient_id' => $id)));
			if ($targetingintakescount){
				$targetingintakes = $this->Abiturient->Targetingintake->find('all', array('conditions' => array('Targetingintake.abiturient_id' => $id)));
			}
			// для формирования преимущества (приоритета)
			$prioritetscount = $this->Abiturient->AbiturientsPrioritet->find('count', array('conditions' => array('AbiturientsPrioritet.abiturient_id' => $id)));
			if ($prioritetscount){
				$prioritets = $this->Abiturient->Prioritet->find('list');
				$abiturientsprioritets = $this->Abiturient->AbiturientsPrioritet->find('all', array('conditions' => array('AbiturientsPrioritet.abiturient_id' => $id)));
			}
			$this->set(compact('genders', 'citizenships', 'regions',
			'schoolflanguages', 'educationdoctypes',
			'relativescount','relatives', 'relativestypes',
			'selectedprofessionscount','selectedprofessions', 'facultets',
			'minimalresults',
			'subjectsprofessions', 
			'contractscount', 'contracts',
			'resultscount', 'results', 'resulttypes', 'subjects',
			'privilegescount', 'privileges', 'abiturientsprivileges',
			'targetingintakescount', 'targetingintakes',
			'prioritetscount', 'prioritets', 'abiturientsprioritets'
			));
		}	// end if (empty($this->data))			
	} // end approvedsearch
/******************************************************************************************
 * 
 * 				СГЕНЕРИРОВАННЫЕ КЕЙКОМ МЕТОДЫ 
 * 
 *****************************************************************************************/	
		
	function view($id = null) {
		if (!$id) {
			$this->Session->setFlash(__('Invalid Abiturient', true));
			$this->redirect(array('action' => 'index'));
		}
		$this->set('abiturient', $this->Abiturient->read(null, $id));
	}

	function add() {
		if (!empty($this->data)) {
			$this->Abiturient->create();
			if ($this->Abiturient->save($this->data)) {
				$this->Session->setFlash(__('The Abiturient has been saved', true));
				$this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The Abiturient could not be saved. Please, try again.', true));
			}
		}
		$prioritets = $this->Abiturient->Prioritet->find('list');
		$genders = $this->Abiturient->Gender->find('list');
		$citizenships = $this->Abiturient->Citizenship->find('list');
		$regions = $this->Abiturient->Region->find('list');
		$schoolflanguages = $this->Abiturient->Schoolflanguage->find('list');
		$educationdoctypes = $this->Abiturient->Educationdoctype->find('list');
		$this->set(compact('prioritets', 'genders', 'citizenships', 'regions', 'schoolflanguages', 'educationdoctypes'));
	}

	function edit($id = null) {
		if (!$id && empty($this->data)) {
			$this->Session->setFlash(__('Invalid Abiturient', true));
			$this->redirect(array('action' => 'index'));
		}
		if (!empty($this->data)) {
			if ($this->Abiturient->save($this->data)) {
				$this->Session->setFlash(__('The Abiturient has been saved', true));
				$this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The Abiturient could not be saved. Please, try again.', true));
			}
		}
		if (empty($this->data)) {
			$this->data = $this->Abiturient->read(null, $id);
		}
		$prioritets = $this->Abiturient->Prioritet->find('list');
		$genders = $this->Abiturient->Gender->find('list');
		$citizenships = $this->Abiturient->Citizenship->find('list');
		$regions = $this->Abiturient->Region->find('list');
		$schoolflanguages = $this->Abiturient->Schoolflanguage->find('list');
		$educationdoctypes = $this->Abiturient->Educationdoctype->find('list');
		$this->set(compact('prioritets','genders','citizenships','regions','schoolflanguages','educationdoctypes'));
	}

	function delete($id = null) {
		if (!$id) {
			$this->Session->setFlash(__('Invalid id for Abiturient', true));
			$this->redirect(array('action' => 'index'));
		}
		if ($this->Abiturient->del($id)) {
			$this->Session->setFlash(__('Abiturient deleted', true));
			$this->redirect(array('action' => 'index'));
		}
		$this->Session->setFlash(__('The Abiturient could not be deleted. Please, try again.', true));
		$this->redirect(array('action' => 'index'));
	}

}
?>